Skip to content

Conversation

@filzrev
Copy link
Contributor

@filzrev filzrev commented Jun 12, 2025

This PR intended to fix issue that following xUnit warnings are recorded on test discovery.

BenchmarkDotNet.IntegrationTests: Non-serializable data ('System.Object[]') found for 'BenchmarkDotNet.IntegrationTests.ValuesReturnedByBenchmarkTest.AnyValueCanBeReturned'; falling back to single test case.

This warning is occurred when Theory data contains non serialize/deserialize data by xunit (IToolchain, Jit, and `Runtime).

It's not needed to display individual test cases on TestExplorer.
So suppress these warnings by specifing DisableDiscoveryEnumeration=true parameter.

Other changes
Add condition to reference TestAdapter project when using Release configuration only.
It's required because it failed to load BenchmarkDotNet assembly when build project with Debug configuration.
It's caused by strong-named assemblies are required to load assembly.
(These log can be confirmed by Tests log on VS output window)

@timcassell
Copy link
Collaborator

TestAdapter should not have to be removed in Debug configuration. We should rather fix whatever the issue is.

@filzrev
Copy link
Contributor Author

filzrev commented Jun 13, 2025

TestAdapter should not have to be removed in Debug configuration. We should rather fix whatever the issue is.

I've removed Condition from this PR.

To fix Debug configuration issue.
It need to override common.props setting for TestAdapter project.

@timcassell
Copy link
Collaborator

To fix Debug configuration issue. It need to override common.props setting for TestAdapter project.

Just set <SignAssembly>false</SignAssembly> and leave a comment why, should be fine.

@filzrev filzrev force-pushed the chore-suppress-xunit-nonserializable-warnings branch from 24da94a to 52dff7f Compare June 13, 2025 05:56
@filzrev
Copy link
Contributor Author

filzrev commented Jun 13, 2025

I've removed Condition from this PR. (It's not not pushed)

Just set false and leave a comment why, should be fine.

When TestAdapter assembly is loaded by TestExplorer.
Assembly must be signed.
Without assembly signing. It failed to load assembly (It's occurred on .NET 4.6.2 target.)
Error log is recorded on output window's Tests pane.

I'll try to create another PR that enable SignAssembly for Debug build also.

@filzrev filzrev force-pushed the chore-suppress-xunit-nonserializable-warnings branch from 52dff7f to 93c4c97 Compare June 13, 2025 07:01
@timcassell timcassell merged commit de8ba07 into dotnet:master Jun 14, 2025
8 checks passed
@AndreyAkinshin AndreyAkinshin added this to the v0.15.2 milestone Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants